package com.service.hibernate.pojos;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.service.hibernate.pojos.ServicesUses.ServicesUses;



@SuppressWarnings("serial")
@Entity
@Table(name = "services")
public class Services implements Serializable {

	private int serviceId;
	private int kilometers;
	private String serviceType;
	//private String vehicleId;
	private Date serviceDate;
	private String status;
	
	private Vehicles vehicle;

	private List<ServicesUses> items=new ArrayList<ServicesUses>();
	

	public Services() {
	}

	public Services(int serviceId, int kilometers, String serviceType, Date serviceDate,Vehicles vehicle) {
		this.serviceId = serviceId;
		this.kilometers = kilometers;
		this.serviceType = serviceType;
		//this.vehicleId = vehicleId;
		this.serviceDate = serviceDate;
		this.vehicle=vehicle;
	}
	
	

	public Services(int serviceId, int kilometers, String serviceType, Date serviceDate, String status,
			List<ServicesUses> items) {
		super();
		this.serviceId = serviceId;
		this.kilometers = kilometers;
		this.serviceType = serviceType;
		//this.vehicleId = vehicleId;
		this.serviceDate = serviceDate;
		this.status = status;
		this.items = items;
	}

	@Id
	@GeneratedValue
	@Column(name = "service_id")
	public int getServiceId() {
		return serviceId;
	}

	public void setServiceId(int serviceId) {
		this.serviceId = serviceId;
	}

	@Column(name = "kilometers")
	public int getKilometers() {
		return kilometers;
	}

	public void setKilometers(int kilometers) {
		this.kilometers = kilometers;
	}

	@Column(name = "service_type")
	public String getServiceType() {
		return serviceType;
	}

	public void setServiceType(String serviceType) {
		this.serviceType = serviceType;
	}

	/*@Column(name = "vehicle_id")
	public String getVehicleId() {
		return vehicleId;
	}

	public void setVehicleId(String vehicleId) {
		this.vehicleId = vehicleId;
	}*/

	@Column(name = "service_data")
	public Date getServiceDate() {
		return serviceDate;
	}

	public void setServiceDate(Date serviceDate) {
		this.serviceDate = serviceDate;
	}

	@Column(name="status")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@OneToMany(fetch=FetchType.LAZY,mappedBy="pk.service")
	public List<ServicesUses> getServicesUses() {
		return items;
	}

	public void setServicesUses(List<ServicesUses> items) {
		this.items = items;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "vehicle_id", nullable = false)
	public Vehicles getVehicle() {
		return vehicle;
	}

	public void setVehicle(Vehicles vehicle) {
		this.vehicle = vehicle;
	}
	
	
	
	
}
